package com.hmall.mapper;

import com.hmall.model.MallPushMessage;
import com.hmall.util.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MallPushMessageMapper extends MyMapper<MallPushMessage> {

    Integer countNoReadMessage(@Param("userName") String userName);

    void myInsert(@Param("pushMessage") MallPushMessage pushMessage);

    List<MallPushMessage> mobileUserMessage(@Param("userName") String username, @Param("typeList") List<String> typeList);


    void mobileSetIsRead(@Param("messageId") Integer messageId);

    void mobileSetAllRead(@Param("userName") String userName, @Param("typeList") List<String> typeList);

    void  insertPushMsg(@Param("msg") MallPushMessage msg);

    void updateIsReadPushMsgById(@Param("isRead") Integer isRead, @Param("messageId") Integer messageId);

    void cancelPushMsgById(@Param("enable") Integer enable, @Param("messageId") Integer messageId);

    List<MallPushMessage> selectDirectPushMsgPage(@Param("pageStart") Integer pageStart, @Param("pageSize") Integer pageSize, @Param("username") String username);

    Integer selectDirectPushMsgTotal(@Param("username") String username);

    List<MallPushMessage> selectPublicPushMsgPage(@Param("pageStart") Integer pageStart, @Param("pageSize") Integer pageSize);

    Integer selectPublicPushMsgTotal();

    Integer selectNoReadContByDirect(@Param("username") String username);

    Integer selectNoReadContByPublic();

    Integer selectNoReadContByUsername(@Param("username") String username);

    Integer selectIdByNo(@Param("messageNo") Long messageNo);

    int selectCountByType(@Param("username") String username, @Param("typeList") List<String> typeList);

    MallPushMessage selectOneByType(@Param("username") String username, @Param("typeList") List<String> typeList, @Param("isRead") Integer isRead);

    MallPushMessage selectByMessageId(@Param("username") String username, @Param("messageId") Integer messageId);

    Integer selectByMessageNo(@Param("messageNo") Long messageNo);
}